
package com.eling.elcms.travel.webapp.controller;

import com.eling.elcms.core.dao.hibernate.search.SearchCondition;
import com.eling.elcms.core.webapp.controller.BaseFormController;
import com.eling.elcms.core.webapp.controller.Msg;
import com.eling.elcms.core.webapp.spring.ModelFilling;
import com.eling.elcms.travel.model.ReturnCredentials;
import com.eling.elcms.travel.model.view.ReturnCredentialsView;
import com.eling.elcms.travel.service.IReturnCredentialsManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@Controller
public class ReturnCredentialsController extends BaseFormController{
	
//	@Autowired
//	IApprovalProcessService approvalProcessService;
	@Autowired
	private IReturnCredentialsManager returnCredentialsManager;
	
	@RequestMapping("/api/returncredentials/save")
    @ResponseBody
	public ReturnCredentials save(@ModelAttribute@ModelFilling ReturnCredentials cond){
		
		return returnCredentialsManager.save(cond);
	}
	
	@RequestMapping("/api/returncredentials/{pkReturnCredentials}/delete")
	@ResponseBody
	public Msg delete(@PathVariable Long pkReturnCredentials){
		returnCredentialsManager.remove(pkReturnCredentials);
		return new Msg("删除成功");
	}
	
	@RequestMapping("/api/returncredentials/query")
    @ResponseBody
	public List<ReturnCredentials> query(@ModelAttribute ReturnCredentials cond){
		return returnCredentialsManager.query(cond);	
	}

	@RequestMapping("/api/returncredentials/search*")
	@ResponseBody
	public List<ReturnCredentials> search(@ModelAttribute SearchCondition sc,@ModelAttribute ReturnCredentials cond){
		sc.setQueryCondition(cond);
		return returnCredentialsManager.search(sc);
	}
	
	@RequestMapping("/api/returncredentials/exitQuery")
	@ResponseBody
	public List<ReturnCredentialsView> exitQuery(@RequestParam(value="status") String status){
		
		return returnCredentialsManager.exitQuery(status);
	}
	
	@RequestMapping("/api/returncredentials/commit")
    @ResponseBody
	public ReturnCredentials Commit(@ModelAttribute@ModelFilling ReturnCredentials cond){
		return returnCredentialsManager.Commit(cond);
	}
}
